package com.example.admin.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.first.myvideo.video.MyVideoPlayer;

import java.util.LinkedHashMap;

public class MainActivity extends AppCompatActivity {
    private MyVideoPlayer video;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        String path="https://v4.438vip.com/20180311/3Q4fNFYh/index.m3u8";
        String path2="https://v3.438vip.com/20180124/1GqJJBKZ/index.m3u8";
        String path3="https://v3.438vip.com/20180207/u1qlMlMS/index.m3u8";
        LinkedHashMap<String,String> map=new LinkedHashMap<>();
        map.put("标清",path);
        map.put("高清",path2);
        map.put("超清",path3);
        video = (MyVideoPlayer) findViewById(R.id.video);
        video.setPath(map).setTitle("xxxx").start(true);
    }


    @Override
    protected void onStop() {
        super.onStop();
        video.pause();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        video.releasePlayer(true);
    }

    @Override
    public void onBackPressed() {
        if ( video.onBackPressd())return;
        super.onBackPressed();
    }
}
